﻿using System.Collections.Generic;

namespace M2Server
{
    public class ScriptEngine
    {
        public delegate void TNpcCondition(TPlayObject PlayObject, TQuestConditionInfo QuestConditionInfo, ref bool Result);
        /// <summary>
        /// 检查脚本字典
        /// </summary>
        public ConditionFunction m_QuestCondition;
        /// <summary>
        /// 执行脚本字典
        /// </summary>
        public Dictionary<int, string> m_QuestAction;

        public ScriptEngine()
        {
            m_QuestCondition = new ConditionFunction();
            m_QuestCondition.InitNpcCondition();
        }

        public void Execute(TNormNpc normNpc, TPlayObject playObject, TQuestConditionInfo questConditionInfo, ref bool result)
        {
            result = false;
            if (m_QuestCondition.CheckCmd(questConditionInfo.nCMDCode))
            {
                m_QuestCondition.Invoke(normNpc, playObject, questConditionInfo, ref result);
            }
        }
    }
}
